package top.lingchen.blogadmin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.lingchen.blogadmin.bean.Permission;
import top.lingchen.blogadmin.service.PermissionService;
import top.lingchen.blogadmin.vo.Result;
import top.lingchen.blogadmin.vo.params.PageParam;

/**
 * @Author 凌宸
 * @create 2021-12-19 下午 10:24
 * @Description
 * @Version 1.0
 */
@RestController
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    private PermissionService permissionService;

    @PostMapping("/permission/permissionList")
    public Result listPermission(@RequestBody PageParam pageParam){
        return permissionService.listPermission(pageParam);
    }

    @PostMapping("/permission/add")
    public Result add(@RequestBody Permission permission){
        return permissionService.add(permission);
    }

    @PostMapping("/permission/update")
    public Result update(@RequestBody Permission permission){
        return permissionService.update(permission);
    }

    @GetMapping("/permission/delete/{id}")
    public Result delete(@PathVariable("id") Long id){
        return permissionService.delete(id);
    }
}
